package com.cjjd.c.feature.mine.membercard;

import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.cjjd.c.R;
import com.cjjd.c.base.MyBaseAdapter;
import com.cjjd.c.bean.MemberCardDetailItemBean;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * ----------------------------------
 * Created by xyd on 2017/8/15.
 * <p/>
 * 描  述：
 * <p/>
 * 修订历史:
 * ----------------------------------
 */

public class MemberCardDetailAdapter extends MyBaseAdapter {

    public MemberCardDetailAdapter(FragmentActivity mContext) {
        super(mContext);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_membercard_detail2, parent, false);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        MemberCardDetailItemBean itemBean = (MemberCardDetailItemBean) getItem(position);

        viewHolder.tvHotelPrepare.setText(itemBean.typeName);
        viewHolder.tvPrepareTime.setText(itemBean.createTime);
        viewHolder.tvPoint.setText("+" + itemBean.intergralCount);

        return convertView;
    }

    static class ViewHolder {
        @Bind(R.id.tv_hotel_prepare)
        TextView tvHotelPrepare;
        @Bind(R.id.tv_prepare_time)
        TextView tvPrepareTime;
        @Bind(R.id.tv_point)
        TextView tvPoint;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
